// app.js
App({
  onLaunch() {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []

    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
    // 登录
    wx.login({
      success(res){
        console.log('code====',res.code);
        wx.request({
          url: 'http://localhost:3000/login',
          method:'POST',
          data:{
            appid:'wx2cb2c1b444169f7d',	
            secret:'12256f4e10311127dea14185ee986e9e',
            code: res.code,
          },
          success:res=>{
            console.log(res.data)
            wx.setStorageSync('session_key', res.data.session_key)
            //openid
            wx.setStorageSync('openid', res.data.openid)
          }
        })
      }
    })
  },
  globalData: {
    userInfo: null
  }
})
